#import "RNStore.h"
#import "RNAisle.h"
#import "RNConstants.h"

//static id editItem;

@implementation RNStore 

@dynamic title;
@dynamic aisles;
@dynamic icon;

-(BOOL)canContainObjectsWithEntityNames:(NSArray *)entityNames {
    NSArray *entitiesICanContain = [entityNames filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self LIKE %@ OR self LIKE %@ OR self LIKE %@", RNEntityNameAisle, RNEntityNameItem, RNEntityNameListItem]];
    return ([entitiesICanContain count] == [entityNames count]);
}

-(NSArray *)children {
    return nil;
}

-(id)parent {
    return nil;
}

-(NSDictionary *)objectDictionary {
    NSMutableDictionary *objectDictionary = [NSMutableDictionary dictionary];
    [objectDictionary setValue:[self title] forKey:RNTitleKey];
    [objectDictionary setValue:[self icon] forKey:@"icon"];
    return objectDictionary;
}

-(void)setObjectDictionary:(id)objectDictionary {
    if ([objectDictionary isKindOfClass:[NSString class]])
        [self setTitle:objectDictionary];
    else if ([objectDictionary isKindOfClass:[NSDictionary class]])
        [self setTitle:[objectDictionary valueForKey:RNTitleKey]];
}

@end
